from sqlalchemy import create_engine
from jsjj.util.configUtil import *


def getConn():
    # 连接database
    # pool_timeout
    # 试试CS的连接池
    engine = create_engine(getIni('db', 'mysqlUrl'), pool_size=20, max_overflow=0, pool_recycle=-1, pool_timeout=3600,
                           pool_pre_ping=True)
    con = engine.connect()
    # con.connection
    return engine, con


if __name__ == '__main__':
    # 连接database
    engine = create_engine(getIni('db', 'mysqlUrl'))
    con = engine.connect()
